<?php 
function saveImage($path)
 {  
 	if(!preg_match('/\/([^\/]+\.[a-z]{3,4})$/i',$path,$matches))
 	{
 		//die('Use image please');
 	} 
 		$image_name = strToLower($matches[1]);
 	  	$ch = curl_init ($path);
 	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 	    curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
 	    $img = curl_exec ($ch);  curl_close ($ch);
 	    $fp = fopen('upload/1.jpg','w');
 	    fwrite($fp, $img);
 	    fclose($fp); 
 } 
 	saveImage('http://wx.qlogo.cn/mmopen/u7JbGkByJCdCZ0GSsp0E0XwQyCmyY3DiaRQyu0MTjGQ2UhL80uNaYRSqsx3548uFVO0nD551db0jtcXRzJLwEIbgia8hSMG7ibt/0'); 
?> 
